define(['core', 'template-web', 'layer'], function (c, tpl, layer) {
    'use strict';
    var html = [
        '<div class="drawer pure-menu custom-restricted-width">',
        '    <ul class="pure-menu-list">',
        '        <li class="pure-menu-item">',
        '            <a href="index.html" class="pure-menu-link">回首页</a>',
        '        </li>',
        '        <li class="pure-menu-item">',
        '{{if show == "design"}}',
        '            <a href="design.html" class="pure-menu-link">标签设计</a>',
        '{{else}}',
        '            <a href="print.html" class="pure-menu-link">标签打印</a>',
        '{{/if}}',
        '        </li>',
        '        <li class="pure-menu-item">',
        '            <a href="javascript:void(0);" onclick="location.reload()" class="pure-menu-link">重新加载</a>',
        '        </li>',
        '    </ul>',
        '</div>',
    ].join('\n')
    var compiled = tpl.compile(html)
    var content
    return {
        init: function (target, show) {
            content = compiled({ show: show })
            var el = c.one(target)
            el.onclick = this.open
        },
        open: function () {
            layer.open({
                type: 1,
                content: content,
                anim: 'down',
                style: 'position:fixed; top:50px; right:0; width: 100px;'
            })
        }
    }
})
